package com.lanchetech.bean.response;


import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

public class UserGenderConverter implements Converter<Integer> {


    @Override
    public Class supportJavaTypeKey() {
        return Integer.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return null;
    }

    @Override
    public CellData convertToExcelData(Integer gender, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        String genderLabel = "未知";
        switch(gender){
            case 0:
                genderLabel = "未知";
                break;
            case 1:
                genderLabel = "男";
                break;
            case 2:
                genderLabel = "女";
                break;
            default:
                break;
        }
        return new CellData(genderLabel);
    }
}
